#[derive(Debug)]
pub enum Gender {
    Unspecified = 0,
    Female = 1,
    Male = 2,
}
#[derive(Debug, Copy, Clone)]
pub struct UserId(pub u64);
#[derive(Debug, Copy, Clone)]
pub struct TopicId(pub u64);
#[derive(Debug)]
pub struct User {
    pub id: UserId,
    pub name: String,
    pub gender: Gender,
}
#[derive(Debug)]
pub struct Topic {
    pub id: TopicId,
    pub name: String,
    pub owner: UserId,
}
#[derive(Debug)]
pub enum Event {
    Join((UserId, TopicId)),
    Leave((UserId, TopicId)),
    Message((UserId, TopicId, String)),
}
pub const PI:f64=3.1415926;

pub static USER0:&str="ROOT";

pub fn process_event(event:&Event){
    match event {
        Event::Join((uid,tid)) => {println!("user {:?} joined",uid)},
        // _ => println!("error"),
        Event::Leave((uid,tid)) => {println!("user {:?} left {:?}",uid,tid)},
        Event::Message((_,_,msg)) => {println!("broadcast: {}",msg)},
    }
}

pub fn process_simple_one(event:&Event){
    if let Event::Message((_,_,msg)) = event{
        println!("broadcast :{}",msg)
    }
}
